package com.singzi.leetcode.N200;

public class T0168 {
}

class Solution0168 {
    public int majorityElement(int[] nums) {

        int count = 1;
        for(int i = 1; i < nums.length;i++){
            if(nums[i] == nums[0]) count++;
            else count--;
            if(count == 0) nums[0] = nums[i];
        }
        return 0;
    }
}